{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Getting Started\n",
    "\n",
    "All you need for this tutorial is\n",
    "- a <b>Python 3.5+ Interpreter</b> together with the python packages <b>jupyter, numpy, scipy, pandas and matplotlib</b>\n",
    "- the [material of this tutorial](https://github.com/padas-pub/python-tutorials) in form of jupyter notebook files (.ipynb)\n",
    "\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 1. Set up a Python Interpreter"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "The easiest way to set up a working python environment is by installing Anaconda - a bundle consisting of the Python interpreter, pre-compiled packages, tools for handling virtual environments, package management, etc."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##  1.1 Install Anaconda\n",
    "Please follow the installation steps according to your operating system.\n",
    "\n",
    "###   For Linux users\n",
    "\n",
    "[Click and download the Anaconda installer for Linux.](https://www.anaconda.com/download/).\n",
    "\n",
    "Choose version **3.5 or higher**.\n",
    "\n",
    "Open your terminal and type the following command\n",
    "\n",
    "<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"background-color:#d2d2d2\">        &#36; bash ~/Downloads/Anaconda3-4.2.0-Linux-x86_64.sh </span></p>\n",
    "Change ~/Downloads with your actual path and Anaconda3-4.2.0-Linux-x86_64.sh with your actual file name.\n",
    "After installing anaconda successfully run the following command in your terminal:\n",
    "<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"background-color:#d2d2d2\">export PATH=\"~/anaconda3/bin:$PATH\"</span></p>\n",
    "\n",
    "Run in your command line: \n",
    "\n",
    "<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"background-color:#d2d2d2\">nano ~/.bashrc </span></p>\n",
    "\n",
    "Add the following line: \n",
    "\n",
    "&nbsp;&nbsp;&nbsp;&nbsp; export PATH=~/anaconda3/bin:$PATH\n",
    " \n",
    "Save and close the editor.\n",
    " \n",
    "Finally, close and re-open your terminal so the changes can take effect.\n",
    "\n",
    "You can check your installation by typing conda \"list command\" in your terminal. If anaconda is susccessfully installed this command will display a list of installed packages.\n",
    "\n",
    "###  For Windows users\n",
    "\n",
    "[Click and download the Anaconda installer for Windows.](https://www.anaconda.com/download/) \n",
    "\n",
    "Choose version **3.5 or higher**.\n",
    "\n",
    "Double click the Anaconda installer and follow the prompts.\n",
    "\n",
    "You can check your installation by typing conda \"list command\" in your Command Prompt. If anaconda is successfully installed this command will display a list of installed packages.\n",
    "\n",
    "###  For OS X users\n",
    "\n",
    "[Click and download the Anaconda installer for OS X.](https://www.anaconda.com/download/) \n",
    "\n",
    "\n",
    "Download the command line installer for Anaconda with Python **3.5 or higher**.\n",
    "\n",
    "Run the following command line:\n",
    "<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"background-color:#d2d2d2\"> &#36; bash ~/Downloads/Anaconda3-4.2.0-MacOSX-x86_64.sh</span></p>\n",
    "\n",
    "Change ~/Downloads with your actual path and Anaconda3-4.2.0-MacOSX-x86_64.sh with your actual file name.\n",
    "\n",
    "If your installation is successfull , the message “Installation finished.” will be displayed.\n",
    "\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 1.2 Use Anaconda\n",
    "\n",
    "###  Launch Anaconda\n",
    "\n",
    "You can run anaconda navigator via the following command line:\n",
    "\n",
    "<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"background-color:#d2d2d2\"> &#36; anaconda-navigator</span></p>\n",
    "\n",
    "You can run the **jupyter notebook** via the following command line:\n",
    "\n",
    "<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"background-color:#d2d2d2\"> &#36; jupyter notebook</span></p>\n",
    "\n",
    "\n",
    "###  Install package\n",
    "\n",
    "To install a package, open your terminal window and type the following command to install for example the \"atlas\" package:\n",
    "<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"background-color:#d2d2d2\"> &#36; conda update conda </span></p>\n",
    "<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"background-color:#d2d2d2\">  &#36; conda install atlas </span></p>\n",
    "Or you can launch the Anaconda Navigator with the command line: \n",
    "<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"background-color:#d2d2d2\"> &#36; anaconda-navigator</span></p>\n",
    "\n",
    "The graphic interface of anaconda navigator will appear. Go to the environments in the left side and choose not installed and you will get this interface.\n",
    "\n",
    "![Install package](images/install.png)\n",
    "\n",
    "Check any package you want, hit apply which will appear in the bottom and then accept the installation of the new package.\n",
    "\n",
    "\n",
    "###  Update package\n",
    "\n",
    "To update a package, open your terminal window and type the following command to update for example the \"atlas\" package:\n",
    "<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"background-color:#d2d2d2\"> &#36; conda update conda</span></p>\n",
    "<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"background-color:#d2d2d2\">  &#36; conda update atlas </span></p>\n",
    "\n",
    "Or you can launch the Anaconda Navigator with the command line: \n",
    "<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"background-color:#d2d2d2\"> &#36; anaconda-navigator</span></p>\n",
    "\n",
    "The graphic interface of anaconda navigator will appear. Go to the environments in the left side and you will get this interface.\n",
    "Click on the blue arrow corresponding to the chosen package and then hit apply which is in the bottom and then hit ok.\n",
    "\n",
    "\n",
    "![Update package](images/update.png)\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 1.3 Install Anaconda Environment\n",
    "\n",
    "You can extract the list of installed packages via this command line:\n",
    "\n",
    "<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"background-color:#d2d2d2\"> &#36; conda list -e > req.txt</span></p>\n",
    "\n",
    "You can install the environment requirement file\n",
    "\n",
    "<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"background-color:#d2d2d2\"> &#36; conda create -n new environment --file req.txt</span></p>\n",
    "\n",
    "## 1.4 Reference\n",
    "http://docs.anaconda.com/anaconda/install/\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 2. Clone Repository\n",
    "\n",
    "###  Install git \n",
    "#### For Linux users\n",
    "\n",
    "Use this command to download git in case you don't have it on your system\n",
    "<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"background-color:#d2d2d2\"> &#36; apt-get install git</span></p>\n",
    "\n",
    "#### For Windows users\n",
    "\n",
    "Download git program from this [website](http://msysgit.github.io).\n",
    "\n",
    "Install the downloaded program.\n",
    "\n",
    "#### For OS X\n",
    "\n",
    "Download the graphic installer from this [link](http://sourceforge.net/projects/git-osx-installer/)\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Clone git repository\n",
    "#### For Windows users\n",
    "\n",
    "Create a Git bash with a right click on the mouse\n",
    "\n",
    "Run the following command in the git terminal to clone the python-tutorials repository:\n",
    "<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"background-color:#d2d2d2\"> &#36; git clone https://github.com/padas-pub/python-tutorials.git</span></p>\n",
    "\n",
    "#### For Linux and OS X users\n",
    "\n",
    "Run the following command in the git terminal in order to clone the python-tutorials repository:\n",
    "<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"background-color:#d2d2d2\"> &#36; git clone https://github.com/padas-pub/python-tutorials.git</span></p>"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 3. Execute Python code in Jupyter noteboks"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Navigate to your local python-tutorials folder and run jupyter notebook via this command:\n",
    "<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"background-color:#d2d2d2\"> &#36; jupyter notebook</span></p>\n",
    "\n",
    "Then a browser window should open, showing the content of your local python-tutorials folder.\n",
    "![jupyter notebook](images/jupyter-notebook.png)\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "In order to execute a cell in a jupyter notebook, just hit <b>Shift + Enter</b> or <b>Ctrl + Enter</b>."
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.3"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
